package cn.charlotte.pit.commands;

import cn.charlotte.pit.ThePit;
import cn.charlotte.pit.commands.admin.*;
import cn.charlotte.pit.commands.player.*;
import cn.charlotte.pit.util.cooldown.Cooldown;
import co.aikar.commands.PaperCommandManager;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.gson.Gson;
import org.bukkit.Bukkit;

import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;

public class PitCommands {
    public static final Random random = new Random();
    public static final String PATTEN_DEFAULT_YMD = "yyyy-MM-dd";
    public static final SimpleDateFormat dateFormat = new SimpleDateFormat(PATTEN_DEFAULT_YMD);
    public static final DecimalFormat numFormat = new DecimalFormat("0.00");
    public final Map<UUID, Cooldown> COOLDOWN_SHOW = new HashMap<>();
    public final Cache<UUID, Long> viewCooldown = CacheBuilder.newBuilder()
            .expireAfterWrite(5, TimeUnit.SECONDS)
            .build();


    public final Gson gson = new Gson();
    public final DateFormat format = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
    public final List<UUID> requestDrop = new ArrayList<>();
    public final List<UUID> confirmDrop = new ArrayList<>();

    public PitCommands(ThePit thePit) {

        PaperCommandManager manager = new PaperCommandManager(thePit);

        // 注册玩家命令
        manager.registerCommand(new BakeMaster(this));
//        manager.registerCommand(new Cdk(this));
        manager.registerCommand(new Cool(this));
        manager.registerCommand(new Events(this));
        manager.registerCommand(new IKnowIGotWiped(this));
        manager.registerCommand(new KillRecap(this));
        manager.registerCommand(new KingQuestGui(this));
        manager.registerCommand(new Setting(this));
        manager.registerCommand(new Show(this));
        manager.registerCommand(new Spawn(this));
        // 交易、拍卖相关命令合并(后面拍卖GUI独立)
        manager.registerCommand(new Trade(this));
        manager.registerCommand(new View(this));

        // 注册管理员命令
        manager.registerCommand(new Check(this));
        manager.registerCommand(new Debug(this));
        manager.registerCommand(new Gacha(this));
        manager.registerCommand(new Kaboom(this));
        manager.registerCommand(new Modify(this));
        manager.registerCommand(new ModifyAll(this));
        manager.registerCommand(new OpenMenu(this));
        manager.registerCommand(new PitItems(this));
        manager.registerCommand(new Setup(this));
        manager.registerCommand(new StartEvent(this));
        manager.registerCommand(new Supporter(this));
        manager.registerCommand(new PitTest(this));
        manager.registerCommand(new ForcePrestige(this));
        manager.registerCommand(new ExtraBonus(this));
        manager.registerCommand(new TrashBin());
    }
}
